package org.jeecg.modules.demo.hdSpecialSupervisionFather.service.impl;

import org.aspectj.lang.annotation.AfterThrowing;
import org.jeecg.modules.demo.hdSpecialSupervisionFather.entity.HdSpecialSupervisionFather;
import org.jeecg.modules.demo.hdSpecialSupervisionFather.mapper.HdSpecialSupervisionFatherMapper;
import org.jeecg.modules.demo.hdSpecialSupervisionFather.service.IHdSpecialSupervisionFatherService;
import org.jeecg.modules.demo.hdspecialsupervision.entity.HdSpecialSupervision;
import org.jeecg.modules.demo.hdspecialsupervision.mapper.HdSpecialSupervisionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 专项监督父表
 * @Author: jeecg-boot
 * @Date:   2025-09-11
 * @Version: V1.0
 */
@Service
public class HdSpecialSupervisionFatherServiceImpl extends ServiceImpl<HdSpecialSupervisionFatherMapper, HdSpecialSupervisionFather> implements IHdSpecialSupervisionFatherService {

    @Autowired
    private HdSpecialSupervisionMapper hdSpecialSupervisionMapper;
    @Override
    public void removeHdSpecialSupervision(String id) {
        // 查询选中节点下所有子节点一并删除
        List<String> ids = hdSpecialSupervisionMapper.queryTreeChildIds(id);
        if (ids != null&&!ids.isEmpty()){
//            System.out.println("1 = " + 1);
            hdSpecialSupervisionMapper.deleteBatchIds(ids);
        }
    }

    @Override
    public void removeHdSpecialSupervisionids(List<String> id) {
        List<String> ids=new ArrayList<>();
        for (int i = 0; i < id.size(); i++) {
            // 查询选中节点下所有子节点一并删除
            List<String> id1 = hdSpecialSupervisionMapper.queryTreeChildIds(id.get(i));
            ids.addAll(id1);
        }
        if (ids != null &&!ids.isEmpty()){
            hdSpecialSupervisionMapper.deleteBatchIds(ids);
        }
    }
}
